package com.ccc.dingtalk.service.dingtalk.impl;

import com.ccc.dingtalk.pojo.dingtalk.DingDept;
import com.ccc.dingtalk.service.dingtalk.DeptService;
import com.ccc.dingtalk.util.DingtalkUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author superC
 * @version 1.0.0
 * @date 2023-08-09
 */

@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DingtalkUtil dingtalkUtil;

    @Override
    @Cacheable(value = "allDept", unless = "#result == null || #result.isEmpty()")
    public List<DingDept> getDeptList(String accessToken) {
        return dingtalkUtil.getDeptList(accessToken);
    }
}
